﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NJT.扩展;

namespace FM.Test
{
    [TestClass]
    public class 扩展test
    {
        [TestMethod]
        public void 范围限制()
        {
            int a = 1;
            Assert.AreEqual(a, a.范围限制(0, 10));
            Assert.AreEqual(2, a.范围限制(2, 10));
            Assert.AreEqual(-1, a.范围限制(-20, -1));
            Assert.AreEqual(0, a.范围限制(0, 0));

            double b = 1.23;
            Assert.AreEqual(b, b.范围限制(0, 10));
            Assert.AreEqual(2, b.范围限制(2, 10));
            Assert.AreEqual(-1, b.范围限制(-20, -1));
            Assert.AreEqual(0, b.范围限制(0, 0));

        }
        [TestMethod]
        public void 范围限制T()
        {
            int a = 1;
            Assert.AreEqual(a, a.范围限制(0, 10));
            Assert.AreEqual(2, a.范围限制(2, 10));
            Assert.AreEqual(-1, a.范围限制(-20, -1));
            Assert.AreEqual(0, a.范围限制(0, 0));

            string c = "f";
            Assert.AreEqual(c, c.范围限制<string>("e", "g"));
            Assert.AreEqual("h", c.范围限制("h", "k"));

        }
    }
}
